package kr.hkit.powerjava.chapter21;

class MyExceptions extends Exception {
	public MyExceptions(String message){
		super(message);
	}
}
public class MyExceptionTest {
	public static void checkNegative(int number) throws MyExceptions{
		if(number < 0) {
			throw(new MyExceptions("음수는 안됩니다."));
		}
		System.out.println("다행히 음수가 아니군요.");
	}
	public static void main(String[] args) {
		try{
			checkNegative(1);
			checkNegative(-1);
		}catch(MyExceptions e){
			e.printStackTrace();
		}
	}
}
